﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //作业1
            ArrayList list = new ArrayList() { 2, "SS",666,"嘻嘻嘻","abc" };
            var arr = list.IndexOf  ("abc" );
            if (arr != -1)
            {
                Console.WriteLine("这个集合有abc 这个元素");
            }
            else
            {
                Console.WriteLine("这个集合没有abc 这个元素");
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
               
            //作业2

            ArrayList add = new ArrayList() { 857, 666, 985, 211, "james", "jordan" };

            ArrayList addone = new ArrayList();

            for (int i =0;i<add.Count;i= i + 2)
            {
                addone.Add(add[i]);
            }
            foreach (var v in addone)
            {
                Console.WriteLine("这就是那个新的集合里面的元素："+ v);
            }


            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            //作业3


            ArrayList add1 = new ArrayList() { 456, 15, 65 };
            ArrayList addtwo = new ArrayList() { "ingram", "pual", "jj" };

            add1.InsertRange(1, addtwo);
            
            foreach (var v in add1)
            {
                Console.WriteLine(v );
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            //作业4


            ArrayList add2 = new ArrayList { 965, 255, 52415, 5525, 56 };

            add2.Sort();

            foreach (var v in add2)
            {
                Console.WriteLine(v);
            }
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            //作业5

            ArrayList add3 = new ArrayList() {"sdd","jgy","as",15,5,6 };
            MyCompare myCompare = new MyCompare();
            list.Sort(myCompare);
            foreach (var v in add3)
            {
                Console.WriteLine(v);
            }






        }
    }
}
